package com.techsoul.admin.service.impl;

import com.techsoul.admin.service.IHomeService;
import com.techsoul.module.marketing.pojo.param.PanelSearchParam;
import com.techsoul.module.marketing.pojo.vo.PanelVo;
import com.techsoul.module.marketing.service.IPanelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(readOnly = true)
public class HomeServiceImpl implements IHomeService {

    @Autowired
    private IPanelService panelService;

    /**
     * 获取导航栏
     * @return
     */
    @Override
    public List<PanelVo> getNavbars() {
        PanelSearchParam param = new PanelSearchParam();
        param.setPanelType("navbar")
                .setPanelPosition("home");
        return panelService.findAll(param);
    }

    /**
     * 获取首页轮播图
     * @return
     */
    @Override
    public List<PanelVo> getBanners() {
        PanelSearchParam param = new PanelSearchParam();
        param.setPanelType("banner")
                .setPanelPosition("home");
        return panelService.findAll(param);
    }

    /**
     * 获取首页活动板块
     * @return
     */
    @Override
    public List<PanelVo> getPanels() {
        PanelSearchParam param = new PanelSearchParam();
        param.setPanelPosition("home");
        return panelService.findAll(param);
    }

}
